package com.zimin.cloud.web.controller.system;

import com.zimin.cloud.mine.pojo.system.business.DeptBO;
import com.zimin.cloud.system.api.IDeptFeign;
import com.zimin.shared.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * @author zimin
 * @since 2022/1/29 5:22 下午
 */
@RestController
@RequestMapping("/web/system/dept/api")
public class WebDeptController {


    @Autowired
    private IDeptFeign deptFeign;

    @GetMapping
    public Mono<Result> deptList(DeptBO deptBO) {
        return Mono.just(deptFeign.deptTree(deptBO));
    }

    @PostMapping
    public Mono<Result> save(@RequestBody DeptBO deptBO){
        return Mono.just(deptFeign.save(deptBO));
    }

    @PutMapping
    public Mono<Result> update(@RequestBody DeptBO deptBO){
        return Mono.just(deptFeign.update(deptBO));
    }

    @DeleteMapping
    public Mono<Result> delete(@RequestParam(value = "idList") List<String> idList) {
        return Mono.just(deptFeign.delete(idList));
    }

}
